View Javadoc
1 package jrre; 2 3 /*** 4 * Main class used to run the Java Research Runtime Enviroment. Run this 5 * from the command line with the name of the class file to begin loading. 6 * 7 * For Example: 8 * <code> 9 * java jrre.Main <filename> <i>options</i> 10 * 11 * Options: 12 * <ul> 13 * <li>-v Generates a verbose output based on the JRRE's operations.</li> 14 * <li>-gui Opens the JRRE Console Application on initialisation.</li> 15 * <li>-help Prints an explanation of the options.</li> 16 * </ul> 17 * </code> 18 * 19 * @task add command line switch to enable/disable CONSOLE prefix 20 * on output. 21 * 22 * @author Christopher Ellsworth (Chris@chrisellsworth.com) 23 * @author Clerance Alston (massclax@hotmail.com) 24 */ 25 public class Main { 26 27 /*** 28 * Loads the JRRE from the command line. 29 * @task fix command line args when new gui is complete. 30 * @task remove old gui system. 31 * 32 * @param String args[] The arguments to launch the JRRE with. 33 */ 34 public static void main(String args[]){ 35 36 boolean verbose = false; 37 boolean gui = false; 38 39 JRRE.setRunAtLoad(true); 40 41 String fileName = null; 42 43 for(int i=0;i<args.length;i++){ 44 if(args[i].equalsIgnoreCase("-v")){ 45 verbose = true; 46 } 47 else if(args[i].equalsIgnoreCase("-guiOld")){ 48 gui = true; 49 JRRE.setRunAtLoad(false); 50 } 51 else if(args[i].equalsIgnoreCase("-gui")){ 52 JRRE.setRunAtLoad(false); 53 gui = false; 54 } 55 else if(args[i].equalsIgnoreCase("-help")){ 56 System.out.println(getUsage()); 57 System.exit(0); 58 } 59 else 60 fileName = args[i]; 61 } 62 63 if(fileName == null){ 64 System.out.println("Please specify a class to run."); 65 System.exit(1); 66 } 67 68 jrre.JRRE.setVerbose(verbose); 69 jrre.JRRE.setGui(gui); 70 71 JRRE jvm = new JRRE(fileName); 72 Thread jrreThread = new Thread(jvm); 73 jrreThread.start(); 74 75 // Tempory until new gui is done. 76 if(!gui){ 77 jrre.gui.JRREGUI GUI; 78 jvm.addEventListener(GUI = new jrre.gui.JRREGUI()); 79 new Thread(GUI).start(); 80 //JRRE.run(); 81 } 82 83 } 84 85 /*** 86 * Gets the usage message for the command line use. 87 * 88 * @return The string representing the command line use. 89 */ 90 public static String getUsage(){ 91 92 StringBuffer toReturn = new StringBuffer(); 93 94 toReturn.append("Java Research Runtime Enviroment"); 95 toReturn.append("\nUsage:"); 96 toReturn.append("\n\tjava jrre.Main [-options] class [args...]"); 97 toReturn.append("\n\n\tOptions:"); 98 toReturn.append("\n\t\t-v Enables verbose output"); 99 toReturn.append("\n\t\t-gui Loads the graphical user interface"); 100 toReturn.append("\n\t\t-help [-options] for descriptions"); 101 102 return toReturn.toString(); 103 } 104 }

This page was automatically generated by Maven